package fast.mvc;

import java.beans.PropertyChangeSupport;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;

import fast.data.CharacterClass;
import fast.data.Spec;

public class Settings {
	
	@SuppressWarnings("unused")
	private PropertyChangeSupport changes = new PropertyChangeSupport( this );
	
	private boolean showUpgrades = false;
	private boolean ignoreExp = true;
	
	private HashSet<String> defaultRogue = new HashSet<String>();
	
	private HashSet<String> defaultCombat = new HashSet<String>(
			Arrays.asList(	"combat_use_rupture","combat_use_rupture_during_sync",
							"sync_ar_with_sb","combat_pool_before_sb","combat_waste_cp"));
	private HashSet<String> defaultAssassination = new HashSet<String>(
			Arrays.asList("assa_pool_before_sb"));
	
	private HashSet<String> activeSettings = new HashSet<String>();
	private HashMap<String,Integer> settingsValue = new HashMap<String,Integer>();
	
	public Settings(){}
	
	public Settings(Spec spec){
		activeSettings.clear();
		if(Arrays.asList(Spec.getSpecsByCharacterClass(CharacterClass.rogue)).contains(spec))
			activeSettings.addAll(defaultRogue);
		if(spec == Spec.Combat)
			activeSettings.addAll(defaultCombat);
		if(spec == Spec.Assassination)
			activeSettings.addAll(defaultAssassination);
	}

	public boolean isIgnoreExp() {
		return ignoreExp;
	}

	public void setIgnoreExp(boolean ignoreExp) {
		this.ignoreExp = ignoreExp;
	}

	public boolean isShowUpgrades() {
		return showUpgrades;
	}

	public void setShowUpgrades(boolean showUpgrades) {
		this.showUpgrades = showUpgrades;
	}
	
	public boolean active(String setting){
		return activeSettings.contains(setting);
	}

	public HashSet<String> getActiveSettings() {
		return activeSettings;
	}

	public void toggle(String option) {
		if(active(option))
			activeSettings.remove(option);
		else
			activeSettings.add(option);
	}

	public void setSettingsValue(String string, int value) {
		settingsValue.put(string, value);
	}
}
